#include <bits/stdc++.h>
using namespace std;
struct TreeNode {
	int val;
	TreeNode *left;
	TreeNode *right;
	TreeNode() : val(0), left(nullptr), right(nullptr) {}
	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
	TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
class Test{
public:
	vector<vector<int>> levelOrderBottom(TreeNode* root) {
		queue<TreeNode*> que;
		vector<vector<int>> result;
		if(root == NULL){
			return result;
		}
		que.push(root);
		while(!que.empty()){
			int size = que.size();
			vector<int> vec;
			while(size--){
				TreeNode* cur = que.front();que.pop();
				vec.push_back(cur->val);
				if(cur->left) que.push(cur->left);
				if(cur->right) que.push(cur->right);
			}
			result.push_back(vec);
		}
		reverse(result.begin(),result.end());
		return result;
	}
};


int main(){
	
	return 0;
}
